package com.caoheng.core.util;

import com.caoheng.core.common.Result;
import com.caoheng.core.enums.ResultEnum;

public class ResultUtil {

    public static final int DEFAULT_ERROR_TYPE = 10001;

    public static Result error(ResultEnum resultEnum){
        return new Result(resultEnum);
    }

    public static Result ok(){
        return new Result(ResultEnum.OK_200);
    }

    public static Result error(int code,String msg){
        return new Result(code,msg);
    }

    public static Result ok(Object data){
        return new Result(ResultEnum.OK_200,data);
    }

    public static Result error(String msg){
        return new Result(DEFAULT_ERROR_TYPE,msg);
    }
}
